package org.benjamin.lending.domain.entity;

import java.io.Serializable;

/**
 * Created by xywen on 2017/6/2.
 */
public enum PaymentMethod implements Serializable {
    EQUAL_PRINCIPAL_AND_INTEREST,AFTER_THE_FIRST_INTEREST,REPAYMENT_DUE,EQUAL_PRINCIPAL;

    public static PaymentMethod transform(String name){
        if(name.equalsIgnoreCase("4")){
            return PaymentMethod.EQUAL_PRINCIPAL;
        }
        if(name.equalsIgnoreCase("3")){
            return PaymentMethod.REPAYMENT_DUE;
        }
        if(name.equalsIgnoreCase("2")){
            return PaymentMethod.AFTER_THE_FIRST_INTEREST;
        }
        if(name.equalsIgnoreCase("1")){
            return EQUAL_PRINCIPAL_AND_INTEREST;
        }
        return null;
    }

}
